/*
 * @Author: 陈俊升 761723995@qq.com
 * @Date: 2023-10-07 15:52:09
 * @LastEditors: 陈俊升 761723995@qq.com
 * @LastEditTime: 2024-02-04 17:08:41
 * @FilePath: /hr_new_vue3/src/apis/management/personnel/changeManagement/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/* 人员 人事管理api */

import { ajaxService } from '@/utils/request';

const env = import.meta.env;
// const baseURL1 = env.VITE_API_BASE_URL;
const baseURL1 = env.VITE_DEV_BASE_URL;
const baseURL = env.VITE_DEV_BASE_URL;

/**
 * 获取实习管理列表
 *
 */
export function GetPracticeList(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/status/list',
    method: 'get',
    params,
    baseURL: baseURL
  });
}

/**
 * 修改实习期状态转成试用期/正式
 * ids: 人员id
 * type 1实习转试用 2实习转正式 3确认调动完成
 */
export function ChangePracticeStatus(data: { ids: number[]; type: 1 | 2 | 3 }) {
  return ajaxService(
    {
      url: '/hr/personnel_matters/basic_setting/personnel_settings/lnternship_settings/Internship_Index_library/internship/changes',
      method: 'put',
      data,
      baseURL: baseURL
    },
    {
      message: '修改成功',
      mode: 'success'
    }
  );
}

/**
 * 修改实习期状态转成试用期
 * ids: 人员id
 */
export function ChangePratice2Probation(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/employee/status',
    method: 'put',
    data,
    baseURL: baseURL
  });
}

/**
 * 实习期转正
 * ids: 人员id
 */
export function ChangePratice2Confirm(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/formal',
    method: 'put',
    data,
    baseURL: baseURL
  });
}

/**
 * 修改实习时间
 * id: 人员id
 * custom: 实习时间
 */
export function ChangePraticeDate(data: { id: number; custom: string }) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/intership',
    method: 'put',
    data,
    baseURL: baseURL
  });
}

/**
 * 获取实习调动列表
 *
 */
export function GetPracticeChangeList(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/lnternship_settings/Internship_Index_library/change',
    method: 'get',
    params,
    baseURL: baseURL
  });
}

/**
 * 实习评价-确认调动
 * ids : 人员id
 * type 1实习转试用 2实习转正式
 */
export function ConfirmPracticeChange(data: { ids: number[]; type: 1 | 2 }) {
  return ajaxService(
    {
      url: '/hr/personnel_matters/basic_setting/personnel_settings/lnternship_settings/Internship_Index_library/change',
      method: 'put',
      data,
      baseURL: baseURL
    },
    {
      message: '确认调动成功',
      mode: 'success'
    }
  );
}
